<?php

use Pinenut\Config;

class FormConfig extends Config
{
	static $config = [
		'htmlOptions' => array(
			'method' => 'POST',
		),
		'elements' => array(
			'name' => array(
				'type' => 'text',
				'htmlOptions' => array('placeholder' => 'Имя'),
				'filters' => 'trim',
				'validators' => 'notEmpty',
			),
//			'password' => array(
//				'type' => 'password',
//				'htmlOptions' => array('placeholder' => 'Пароль'),
//				'validators' => 'notEmpty',
//			),
			'city' => array(
				'type' => 'select',
				'htmlOptions' => array('placeholder' => 'Город'),
				'options' => ['very_big' => 'Очень большой', 'big'=>'Большой', 'small' => 'Маленький'],
				'slaveElements' => ['krasnodar'=>['district'], 'moscow'=>['zone'], 'street'],
			),
			'street' => array(
				'master' => 'city',
				'type' => 'text',
				'htmlOptions' => array('placeholder' => 'Улица'),
			),

			'district' => array(
				'master' => 'city',
				'type' => 'text',
				'htmlOptions' => array('placeholder' => 'Район'),
			),

			'email' => array(
				'type' => 'text',
				'htmlOptions' => array('placeholder' => 'E-mail'),
				'validators' => 'email',
			),
			'age' => array(
				'type' => 'text',
				'htmlOptions' => array('placeholder' => 'Возраст'),
				'validators' => array(
						'digits' => array(
							'errorMessage' => 'Не число (пользовательский текст)'
						),

						'notEmpty'
					),
			),
			'submit' => array(
				'value' => 'Добавить',
				'type' => 'submit',
			),
		),
	];
}